//
//  RSReplay.h
//  ReplayStar
//
//  Created by Félix Cloutier on 11-11-02.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef enum RSGameSpeed
{
	RSGameSpeedUnknown = 0,
	RSGameSpeedSlower = 'Slor',
	RSGameSpeedSlow = 'Slow',
	RSGameNormal = 'Norm',
	RSGameSpeedFast = 'Fast',
	RSGameSpeedFaster = 'Fasr'
} RSGameSpeed;

typedef enum RSGameType
{
	RSGameTypeUnknown = 0,
	RSGameType1v1 = '1v1',
	RSGameType2v2 = '2v2',
	RSGameType3v3 = '3v3',
	RSGameType4v4 = '4v4',
	RSGameType6v6 = '6v6',
	RSGameTypeFFA = 'FFA',
	RSGameTypeCustom = 'Cust'
} RSGameType;

typedef enum RSGameRanking
{
	RSGameRankingPrivate = 'Priv',
	RSGameRankingLadder = 'Amm',
	RSGameRankingPublic = 'Pub'
} RSGameRanking;

typedef struct RSVersion
{
	unsigned major;
	unsigned minor;
	unsigned revision;
	unsigned build;
} RSVersion;

@interface RSReplay : NSObject
{
	void* mpq;
	
	RSVersion version;
	
	NSString* mapName;
	CGImageRef mapPreview;
	
	NSArray* players;
	NSArray* teams;
	NSArray* messages;
	
	NSDate* startDate;
	NSDate* endDate;
	NSTimeInterval duration;
}

+(CGImageRef)previewOfFile:(NSString*)file;

@property (readonly) NSString* mapName;
@property (readonly) CGImageRef mapPreview;
@property (readonly) NSArray* teams;
@property (readonly) NSArray* messages;
@property (readonly) NSDate* startDate;
@property (readonly) NSDate* endDate;
@property (readonly) NSTimeInterval duration;

@property (readonly) RSGameSpeed speed;
@property (readonly) RSGameType type;
@property (readonly) RSGameRanking ranking;
@property (readonly) RSVersion version;
@property (readonly) NSString* formattedVersion;

-(id)initWithContentsOfFile:(NSString*)file;

@end
